package com.bsb.base.common.config;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.bsb.base.common.util.StringUtils;
/**
 * 专家头衔
 * @author Administrator
 *
 */
public enum Title2 {
	LAYER("律师","1"),TAX("税务师","2"),ACCOUNTANT("注册会计师","3");
	 // 成员变量  
    private String name;  
    private String index;
	private Title2(String name, String index) {
		this.name = name;
		this.index = index;
	}
	
	  // 普通方法  
    public static String getName(String index) {  
        for (Title2 c : Title2.values()) {  
            if (c.getIndex().equals(index)) {  
                return c.name;  
            }  
        }  
        return null;  
    }  
    
    // 普通方法  
    public static String getNames(String index) {
    	if(StringUtils.isEmpty(index)){
    		return null;
    	}
    	if(!index.contains(",")){
    		for (Title2 c : Title2.values()) {  
    			if (c.getIndex().equals(index)) {  
    				return c.name;  
    			}  
    		}  
    	}
    	String[] split = index.split(",");
    	String title = "";
    	String s = "";
    	for (String str : split) {
    		for (Title2 c : Title2.values()) {  
    			if (c.getIndex().equals(str)) {  
    				s =  c.name+" "; 
    				break;
    			}  
    		}  
    		title += s;
		}
        return title;  
    }  
	
	public static List<Title2> getList(){
		List<Title2> list = new ArrayList<Title2>(Arrays.asList(Title2.values()));
		return list;
	}
	
	
	
	
	
	
	
	
	
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getIndex() {
		return index;
	}
	public void setIndex(String index) {
		this.index = index;
	}
    
	
	
}
